<?php
namespace app\zhonghang\controller;
use think\Controller;
use think\Request;
use think\Db;
use think\Session;
use think\Cache;
use think\Cookie;
use think\Lang;

require_once (APP_PATH . 'api/RewardApi.php');
class Index extends Controller {
 	public function _initialize(){
 		parent::_initialize();
 	}
	//空操作
	public function _empty(){
		header("HTTP/1.0 404 Not Found");
		$this->display('Public:404');
	}
	public function index(){
 	    $chanpin =  DB::name('Goods_category')->where('parent_id',0)->where('is_show',1)->limit('1')->find();
// 	    dump($chanpin);die();
 	    $erweima = DB::name('Website')->where('w_logo_status',1)->find();
// 	    $xx = DB::name('tongyong')->where('parent_id',0)->select();
// 	    $rr = DB::name('Case_type')->order('time desc')->limit('6')->select();
        $rr=Lang::get('sycp');
        $lists = DB::name('Website')->find();
        $lisst = Lang::get('dbcp');
//        dump($list);
        $res = DB::name('Chart')->where('c_sort',0)->select();
        $arr = DB::name('Chart')->where('c_sort',1)->find();
        $this->assign('res',$res);
        $this->assign('arr',$arr);
        $this->assign('rr',$rr);
        $this->assign('lisst',$lisst);
        $this->assign('lists',$lists);
        $this->assign('erweima',$erweima);
        $this->assign('chanpin',$chanpin);
		return $this->fetch();
	}

    public function lang(){
        switch ($_GET['lang']) {
            case 'cn':
                cookie('think_var', 'zh-cn');
                break;
            case 'en':
                cookie('think_var', 'en-us');
                break;
            case 'ja':
                cookie('think_var', 'ja-pn');
                break;
            default:
                cookie('think_var','zh-cn');
        }
    }


}